<div class="modal-body p-b-20">
    <div class="goods-info order-item">
        <div class="edit-goods item">
            <div class="pic-info pull-left">
                <a class="goods-thumb" href="http://www.b2b2c.yunmall.68mall.com/goods-178.html" target="_blank" title="查看商品详情">
                    <img src="http://68yun.oss-cn-beijing.aliyuncs.com/images/15164/shop/1/gallery/2018/08/01/15331135322103.jpg" alt="查看商品详情">
                </a>
            </div>
            <div class="txt-info">
                <div class="desc">
                    <a class="goods-name" href="http://www.b2b2c.yunmall.68mall.com/goods-178.html" target="_blank" title="查看商品详情">古古怪怪</a>
                </div>

            </div>
        </div>
        <div class="edit-content">
            <div class="alert alert-info br-0 m-b-10">选择参与套餐活动的商品的指定规格，未参与的规格，消费者购买此套餐时，此商品的规格不可选</div>
            <h4>设置参与套餐规格</h4>
            <div class="table-responsive" style="max-height: 230px;">
                <table class="table table-hover m-b-0">
                    <thead>
                    <tr>
                        <th class="w200">SKU规格</th>
                        <th class="w150">SKU价格（元）</th>
                        <th class="w100">
                            <label class="cur-p">
                                <input class="icheck m-r-5 va-sub cur-p" data-goods-id=178 checked='checked' type="checkbox" disabled="disabled" >
                                全选
                            </label>
                        </th>
                    </tr>
                    </thead>
                    <tbody>

                    <tr>
                        <td>
                            <div class="ng-binding">颜色：均色</div>
                        </td>
                        <td>2.00</td>
                        <td>
                            <label class="cur-p">
                                <input class="icheck m-r-5 va-sub cur-p sku_select" data-sku-id=871 data-goods-id=178 data-goods-price=2.00 name='checkbox' checked='checked' type="checkbox" disabled="disabled">
                                参与
                            </label>
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <div class="ng-binding">颜色：白色</div>
                        </td>
                        <td>1.00</td>
                        <td>
                            <label class="cur-p">
                                <input class="icheck m-r-5 va-sub cur-p sku_select" data-sku-id=872 data-goods-id=178 data-goods-price=1.00 name='checkbox' checked='checked' type="checkbox" disabled="disabled">
                                参与
                            </label>
                        </td>
                    </tr>

                    </tbody>
                </table>
            </div>

        </div>
    </div>

</div>

<script>
    $().ready(function() {
//选择参与套餐商品规格
        $("body").on("click", "#btn_sku_price_submit", function() {
            var sku_ids = new Array();
            var goods_price_list = new Array();
            var goods_price_all = new Array();
            var goods_id = $(this).data('goods-id');
            $(".sku_select").each(function() {
                var sku_id = $(this).data('sku-id');
                var goods_price = $(this).data('goods-price');
                goods_price_all.push(goods_price.toString());
                if ($(this).is(':checked')) {
                    sku_ids.push(sku_id.toString());
                    goods_price_list.push(goods_price.toString());
                }
            });
//点击商品选择器 rule_max为规则的最高价， 选择商品后rule_max 为 商品的最高价-（最高价与选中规格的最高价的差）
//b-a从大到小排序 a-b 从小到大排序
            goods_price_list.sort(function(a, b) {
                return a - b
            });
            goods_price_all.sort(function(a, b) {
                return a - b
            });
//console.info(goods_price_list);
//console.info(goods_price_all);
            if ((goods_price_list[0] - goods_price_all[0]) > 0) {
                var rule_max = $('.act_price').data("rule-max");
//console.info(rule_max);
                rule_max += (goods_price_list[0] - goods_price_all[0]);
//console.info(rule_max);
                $('.act_price').data("rule-max", rule_max);
            }

            $("#" + goods_id + "-spu").val(sku_ids.join(','));
            $.msg('设置成功', {
                time: 5000
            });
            setTimeout("$.closeAll()", 1000);
        });

//全选
        $("body").on("click", "#checkedAll", function() {
            var goods_id = $(this).data('goods-id');
            if ($(this).is(":checked")) {
                $("input[name='checkbox']").prop("checked", true);
            } else {
                $("input[name='checkbox']").prop("checked", false);
                $("input[name='checkbox']").each(function() {
                });
            }
        });

    });
</script>